﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Fluent="clr-namespace:Fluent" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
  
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Fluent;component\Themes\Office2010\Controls\ScrollBarWhite.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <Fluent:GalleryGroupIconConverter x:Key="GroupIconConverter"/>
    <Style x:Key="GalleryDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
  	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate>
				<Fluent:TwoLineLabel x:Name="twoLineLabel" Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" HasTwoLines="False" HasGlyph="True" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,0,0,0"/>
				<ControlTemplate.Triggers>
					<Trigger Property="IsMouseOver" Value="True">
						<Setter Property="Foreground" TargetName="twoLineLabel" Value="#FFFFD232"/>
					</Trigger>
				</ControlTemplate.Triggers>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
  </Style>
    
    <Style x:Key="GalleryStyle" TargetType="{x:Type Fluent:Gallery}">
  	<Setter Property="Template">		
		<Setter.Value>
			<ControlTemplate TargetType="{x:Type Fluent:Gallery}">
        <ControlTemplate.Resources>
          <ResourceDictionary>

            <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}"/>
          </ResourceDictionary>          
        </ControlTemplate.Resources>
				<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource GalleryBorderBrush}" x:Name="layoutRoot">
					<Grid Width="Auto">
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="*"/>
						</Grid.RowDefinitions>
            <Border x:Name="border" BorderBrush="{x:Null}" BorderThickness="0" Height="13" Background="{DynamicResource GalleryHeaderBackgroundBrush}">
							<Fluent:DropDownButton x:Name="PART_DropDownButton" Style="{StaticResource GalleryDropDownButtonStyle}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Text="{TemplateBinding SelectedFilterTitle}"/>
						</Border>
						<Fluent:RibbonListBox Background="White" x:Name="PART_ListBox"
							DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
							ItemBindingGroup="{TemplateBinding ItemBindingGroup}"
							ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
							ItemContainerStyleSelector="{TemplateBinding ItemContainerStyleSelector}"
							ItemsPanel="{TemplateBinding ItemsPanel}"
							ItemStringFormat="{TemplateBinding ItemStringFormat}"
							ItemTemplate="{TemplateBinding ItemTemplate}"
							ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
							IsTextSearchEnabled="{TemplateBinding IsTextSearchEnabled}"
							ItemsSource="{Binding View.View, RelativeSource={RelativeSource TemplatedParent}}"
							ScrollViewer.VerticalScrollBarVisibility="{Binding VerticalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}}"
							ScrollViewer.HorizontalScrollBarVisibility="{Binding HorizontalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}}" Grid.RowSpan="1" Grid.Row="1" BorderThickness="0"
                                  
                                  >
							<Fluent:RibbonListBox.GroupStyle>
								<GroupStyle x:Name="mineGroup">
									<GroupStyle.ContainerStyle>
										<Style TargetType="{x:Type GroupItem}">
											<Setter Property="Template">
												<Setter.Value>
													<ControlTemplate TargetType="{x:Type GroupItem}">
														<Grid>
															<Grid.ColumnDefinitions>
																<ColumnDefinition Width="Auto"/>
																<ColumnDefinition Width="*"/>
															</Grid.ColumnDefinitions>
															<Grid Height="21" Background="#FFF0F2F5" Grid.ColumnSpan="2" VerticalAlignment="Top">
																<TextBlock Margin="7,0" Text="{Binding Name}" d:LayoutOverrides="Width, Height" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
															</Grid>
															<Image Grid.Column="0" Stretch="None" Margin="4,21,4,0" VerticalAlignment="Top" HorizontalAlignment="Center" x:Name="iconImage">  
																<Image.Source>
																	<MultiBinding Converter="{StaticResource GroupIconConverter}">
																		<Binding Path="Items"/>
																		<Binding ElementName="layoutRoot"/>
																	</MultiBinding>
																</Image.Source>
															</Image>
															<Path Fill="{x:Null}" Stretch="Fill" Stroke="#FFE2E4E7" HorizontalAlignment="Right" Width="1" Height="Auto" Data="M0,0L0,1" Visibility="Visible" x:Name="menuLine" Margin="0,21,0,0"/>
															<ItemsPresenter Grid.Column="1" Margin="0,21,0,0"/>
														</Grid>
														<ControlTemplate.Triggers>
															<Trigger SourceName="iconImage" Property="Source" Value="{x:Null}">
																<Setter TargetName="menuLine" Property="Visibility" Value="Collapsed"/>
																<Setter TargetName="iconImage" Property="Visibility" Value="Collapsed"/>
															</Trigger>
														</ControlTemplate.Triggers>
													</ControlTemplate>
												</Setter.Value>
											</Setter>
										</Style>
									</GroupStyle.ContainerStyle>
								</GroupStyle>
							</Fluent:RibbonListBox.GroupStyle>

						</Fluent:RibbonListBox>
					</Grid>
				</Border>
				<ControlTemplate.Triggers>
					<Trigger Property="HasFilter" Value="False">
						<Setter Property="Visibility" TargetName="border" Value="Collapsed"/>
					</Trigger>
          <!--<Trigger Property="ItemsSource" Value="{x:Null}">
            <Setter Property="ItemsSource" TargetName="PART_ListBox" Value="{Binding Items, RelativeSource={RelativeSource TemplatedParent}}"/>
          </Trigger>          -->
        </ControlTemplate.Triggers>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
  	<Setter Property="Margin" Value="0"/>
  	<Setter Property="BorderThickness" Value="0,0,0,1"/>
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <StackPanel Orientation="Vertical"/>
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Orientation" Value="Horizontal"/>
          <Condition Property="GroupBy" Value="{x:Null}"/>
        </MultiTrigger.Conditions>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Fluent:Gallery}">
              <Border BorderThickness="0,0,0,1" BorderBrush="#FFE2E4E7">
                <Grid Width="Auto">
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                  </Grid.RowDefinitions>
                  <Border x:Name="border" BorderBrush="{x:Null}" BorderThickness="0" Height="13" Background="#FF959595">
                    <Fluent:DropDownButton x:Name="PART_DropDownButton" Style="{StaticResource GalleryDropDownButtonStyle}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Text="{TemplateBinding SelectedFilterTitle}"/>
                  </Border>
                  <Fluent:RibbonListBox Background="White" x:Name="PART_ListBox"
                            DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                            ItemBindingGroup="{TemplateBinding ItemBindingGroup}"
                            ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
                            ItemContainerStyleSelector="{TemplateBinding ItemContainerStyleSelector}"
                            ItemsPanel="{TemplateBinding ItemsPanel}"
                            ItemStringFormat="{TemplateBinding ItemStringFormat}"
                            ItemTemplate="{TemplateBinding ItemTemplate}"
                            ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                            IsTextSearchEnabled="{TemplateBinding IsTextSearchEnabled}"
                            ItemsSource="{Binding View.View, RelativeSource={RelativeSource TemplatedParent}}"
                            ScrollViewer.VerticalScrollBarVisibility="{Binding VerticalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}}"
                            ScrollViewer.HorizontalScrollBarVisibility="{Binding HorizontalScrollBarVisibility, RelativeSource={RelativeSource TemplatedParent}}" Grid.RowSpan="1" Grid.Row="1" BorderThickness="0"
                                  
                                  >                    

                  </Fluent:RibbonListBox>
                </Grid>
              </Border>
              <ControlTemplate.Triggers>
                <Trigger Property="HasFilter" Value="False">
                  <Setter Property="Visibility" TargetName="border" Value="Collapsed"/>
                </Trigger>
                <!--<Trigger Property="ItemsSource" Value="{x:Null}">
                  <Setter Property="ItemsSource" TargetName="PART_ListBox" Value="{Binding Items, RelativeSource={RelativeSource TemplatedParent}}"/>
                </Trigger>-->
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
    </Style.Triggers>
  </Style>
</ResourceDictionary>